
function login() {
    //获取输入的学号密码
    let num = $('#num').val();
    let pwd = $('#pwd').val();
    //获取登录角色
    let role = $("#role").val();
    //是否记住密码，"1"为记住，"0"为不记住
    let remember = $("#remember").prop("checked")? "1" : "0";

    let url = "";
    let backUrl = "";

    if (role === "0"){
        url = "webapi/student/login";
        backUrl = "index";
    } else if (role === "1"){
        url = "webapi/teacher/login";
        backUrl = "manage";
    }

    //ajax发起网络请求
    $.ajax({
        type: "GET",
        url: url,
        data: {
            num: num,
            pwd: pwd,
            remember: remember
        }
    }).done(function (rs) {
        if (rs === 1) {
            //confirm("登录成功")
            location.href = backUrl;
        } else if (rs === -1) {
            alert("账号或密码错误");
        }
    });
}